#!/bin/bash

# prefix
if [[ "$PATH" =~ "/usr/local/bin" ]]; then
    prefix=/usr/local
else
    prefix=/usr
fi
if [ $1 ]; then
    prefix=$1
fi
echo installing to $prefix ...

dmake=dmake.sh
install_path=$prefix/bin/dmake

cp $dmake $install_path
if [ $? -ne 0 ]; then
    echo "Install dmake failed!"
    exit;
fi
chmod 777 $dmake
if [ $? -ne 0 ]; then
    echo "Install dmake failed!"
    exit;
fi

echo done!